Correctly handle inputClosed event - #13
Merged
Merged
Conversation
fabianfett
reviewed
Aug 10, 2026
glbrntt
reviewed
Aug 11, 2026
| return false | ||
|
|
||
| case .headersProcessed: | ||
| // TODO: If a Content-Length header was specified, we need to check whether we have received all the |
Contributor
There was a problem hiding this comment.
Is the TODO tracked somewhere / planned as a follow up?
glbrntt
approved these changes
Aug 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
In
HTTP3ToHTTPServerCodecandHTTP3ToHTTPClientCodec, we currently emit a response/request end part if the client/server terminated the stream with an incomplete response/request. This means that downstream handlers can receive a response/request end part before receiving a head/body part.Per RFC 9114 §4.1, servers should abort the response stream with the
H3_INCOMPLETE_REQUESTerror code when a client-initiated stream is terminated before receiving enough request parts to provide a full response. Additionally, §4.1.1 describes that clients should not use partial responses.Modifications
.inputClosedevent,HTTP3FrameValidatornow checks whether it received a complete request/response, and returns one of three actions:.doNothing(if we received a complete request/response),.notifyDownstream(if we received an incomplete response (clients only)), or.resetStream(if we received an incomplete request (servers only)).HTTP3StreamStateMachinenow passes that action as an associated value on theinputClosedaction.HTTP3StreamHandlerfires theinputClosedevent as before, but for an incomplete message it first fires anHTTP3Errordown the pipeline, and for servers, it also sends aQUICResetStreamEventwith theH3_REQUEST_INCOMPLETEcode.HTTPMessageParsingStateMachineno longer emits an end part when the input closes before a head part arrives.peerTerminatedInboundStreamcase toHTTP3Error.Code.Result
HTTP3ToHTTPServerCodecandHTTP3ToHTTPClientCodecno longer emit a request/response end part if the stream has terminated without a complete request/response.Instead,
HTTP3StreamHandlerhandler notifies downstream handlers with an error, and for servers, the stream is also reset.